<?php
class PermisoController extends Zend_Controller_Action
{
    public function init()
    {
        $formLogin = new Application_Form_Login();
        $this->view->formLogin = $formLogin;
        $model =new Application_Model_Noticias();
        $this-> view->noticias=$model->getAll();
        $modelTesis =new Application_Model_Tesis();
        $this-> view->tesis=$modelTesis->getAll();
        $modelPersona =new Application_Model_Personas();
        $this-> view->persona=$modelPersona->getAll();
        if(Zend_Auth::getInstance()->hasIdentity()){
            $skin=Zend_Auth::getInstance()->getIdentity()->skin;
            $this->_helper->Cambiarskin($skin);
        }
    }          
    
    public function imprimirAction(){
     
        $modelPersona=new Application_Model_Personas();
        $modelRegistro=new Application_Model_Registros();
        $modelTutor=new Application_Model_Tutores();
        $modelAutor=new Application_Model_Autores();
        
        $registro=$modelRegistro->getAll();
        $autor=$modelAutor->getAll();
        $tutor=$modelTutor->getAll();
        
        $count=count($autor);
        $count2=count($registro);
        $count3=count($tutor);
        
        $idUs=$autor[$count-1]->id_autor;
        $idUs2=$tutor[$count3-1]->id_tutor;
        $idReg=$registro[$count2-1]->id_registro;
        
        $datos=$modelAutor->getRow($idUs);
        $idPersonaAutor=$datos->id_persona;
        $datosAutor=$modelPersona->getRow($idPersonaAutor);
        
        $datos2=$modelTutor->getRow($idUs2);
        $idPersonaTutor=$datos2->id_persona;
        $datosTutor=$modelPersona->getRow($idPersonaTutor);
        
        $dRegistro=$modelRegistro->getRow($idReg);
        
        $this->view->datos=$datosAutor;
        $this->view->rDatos=$dRegistro;
        $this->view->tutor=$datosTutor;
     
    }
}